#include<stdio.h>
int main()
{
    FILE*fp=NULL;
    if(NULL == (fp=fopen("demo.c","rb")))
    {
        perror("文件打开失败");
        return -1;
    }
    printf("文件打开成功\n");
    char buf[BUFSIZ]={0};
    size_t ret=0;
    //fread(buf,1,sizeof(buf),fp);
    while((ret = fread(buf,1,sizeof(buf)-1,fp))>0)
    {
        buf[ret]='\0';
        printf("buf:%s",buf);
    }
    fclose(fp);
    return 0;
}